package command.respondente;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import model.Respondente;

import command.ICommand;
import dao.RespondenteDAO;

public class RemoverRespondenteCommand implements ICommand{

	@Override
	public String execute(HttpServletRequest request) throws ServletException,IOException {
		String cod = request.getParameter("codigo");
		int codigo = Integer.parseInt(cod);
		RespondenteDAO dao = new RespondenteDAO();
		try {
			dao.deletar(codigo);
			return "controller.do?acao=listarRespondente";
		} catch (SQLException e) {
			e.printStackTrace();
			return "/paginas/respondente/listar_respondente.jsp?erro=1";
		}
	}

}
